package bagu.test.duoxiancheng;

/**
 * @Author: wzp
 * @CreateTime: 2024-09-13  23:19
 * @Description: 多线程实现的第二种方法，继承Runnable接口
 * @Version: 1.0
 */
public class MyThreadTest2 implements Runnable{
    public static int count = 100;
    @Override
    public void run() {
        while (count > 0){
            System.out.println(Thread.currentThread().getName() + ": " + count--);
        }
    }

    public static void main(String[] args) {
        MyThreadTest2 myThreadTest2 = new MyThreadTest2();
        Thread thread1 = new Thread(myThreadTest2);
        Thread thread2 = new Thread(myThreadTest2);
        thread1.start();
        thread2.start();

    }
}
